import {
  myFetch
} from "./fetch-config";

const url = process.env.VUE_APP_DATA_API;

// 交易列表
export function txList(params) {
  let body = {
    id: 1,
    method: "Tx.TxList",
    params: params
  };
  return myFetch(body, url);
}

// token交易列表
export function tokenTxList(params) {
  let body = {
    id: 1,
    method: "Token.TxList",
    params: params
  };
  return myFetch(body, url);
}

// 代币持有人
export function tokenHolder(params) {
  let body = {
    method: "Token.TokenAddrCount",
    params: params
  };
  return myFetch(body, url);
}

// 代币个人持有人列表
export function tokenHolderList(params) {
  let body = {
    method: "Token.AddrsInfo",
    params: params
  };
  return myFetch(body, url);
}

// 代币个人、合约持有人列表
export function conbineHolderList(params) {
  let body = {
    method: "Account.Search",
    params: params
  };
  return myFetch(body, url);
}

// 主代币持有人总数
export function mainCoinsHolders(params) {
  let body = {
    id: 1,
    method: "Account.Count",
    params: params
  };
  return myFetch(body, url);
}

// 交易总条数
export function getTxCount(params) {
  let body = {
    id: 1,
    method: "Tx.TxCount",
    params: params
  };
  return myFetch(body, url);
}

// 获取区块区间信息
export function getBlocksInfo(params) {
  let body = {
    id: 1,
    method: "BlockStat.StatGets",
    params: params
  };
  return myFetch(body, url);
}

// search区块统计信息
export function searchBlocksInfo(params) {
  let body = {
    id: 1,
    method: "BlockStat.StatSearches",
    params: [params]
  };
  return myFetch(body, url);
}

// 比特元持币排行
export function btyHolderRank(params) {
  let body = {
    id: 1,
    method: "Account.TopAsset",
    params: params
  };
  return myFetch(body, url);
}

// 比特元持币人数总量
export function btyHolderNum() {
  let body = {
    method: "Account.TopAssetCount",
    params: [{}],
    id: 1
  };
  return myFetch(body, url);
}